//
//  LCBaseViewController.m
//  TheLCNews
//
//  Created by apple on 15/11/26.
//  Copyright © 2015年 LC. All rights reserved.
//

#import "LCBaseViewController.h"

@interface LCBaseViewController ()

@end

@implementation LCBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
   //这是网络判断
    [self network];
    self.navigationController.navigationBar.backgroundColor = [UIColor greenColor];
    self.view.backgroundColor = [UIColor whiteColor];

}
#pragma mark -网络状态判断
- (void)network {
    // 检测网络情况
    AFNetworkReachabilityManager *manage = [AFNetworkReachabilityManager sharedManager];
    
    // 开始检测
    [manage startMonitoring];
    [manage setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
        
        switch (status) {
            case AFNetworkReachabilityStatusReachableViaWWAN:
                NSLog(@"4G连接");
                break;
            case AFNetworkReachabilityStatusReachableViaWiFi:
                NSLog(@"WIFI连接");
                break;
            case AFNetworkReachabilityStatusNotReachable: {
                UIAlertView *altView = [[UIAlertView alloc] initWithTitle:@"无网络" message:@"请检查网络" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                [altView show];
               
                NSLog(@"无连接或者3G网络及2G网络");
            } break;
            case AFNetworkReachabilityStatusUnknown:{
                
            }
                NSLog(@"连接状态未知");
                
                break;
        }
    }];
    
    [manage stopMonitoring];
}







- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
